<template>
  <div>
    <div class="header" style="margin-bottom: 100px;">
      <i class="el-icon-s-operation"></i> 年度三相电表各个月功率统计
    </div>
    <div id="duiji" style="width: 1080px;height: 500px;margin-left: 10%;"></div>
  </div>
</template>

<script>
  export default {
    name: 'tpem',
    data() {
      return {
        
      }
    },
    mounted() {
      this.drawLine();
    },
    methods: {
      drawLine() {
        // 基于准备好的dom，初始化echarts实例
        let myChart = this.$echarts.init(document.getElementById('duiji'));
        // 绘制图表
        myChart.setOption({
          title: {
            text: 'power / kwh'
          },
          color: ['#8fffd6', '#007cb6', '#ffb9ac'],
          tooltip: {
            trigger: 'axis',
            axisPointer: {
              type: 'cross',
              label: {
                backgroundColor: '#6a7985'
              }
            }
          },
          legend: {
            data: ['东区', '西区', '北区']
          },
          toolbox: {
            feature: {
              saveAsImage: {}
            }
          },
          grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
          },
          xAxis: [
            {
              type: 'category',
              boundaryGap: false,
              data: ['January', 'February', 'March', 'April', 'May', 'June', 'July','August', 'September', 'October', 'November', 'December']
            }
          ],
          yAxis: [
            {
              type: 'value'
            }
          ],
          series: [
            {
              name: '东区',
              type: 'line',
              stack: 'Total',
              areaStyle: {},
              emphasis: {
                focus: 'series'
              },
              data: [120, 132, 101, 134, 90, 230, 210,120,230,200,90,300]
            },
            {
              name: '西区',
              type: 'line',
              stack: 'Total',
              areaStyle: {},
              emphasis: {
                focus: 'series'
              },
              data: [220, 182, 191, 234, 290, 330, 310,210,330,300,100,400]
            },
            {
              name: '北区',
              type: 'line',
              stack: 'Total',
              areaStyle: {},
              emphasis: {
                focus: 'series'
              },
              data: [150, 232, 201, 154, 190, 330, 410,320,430,400,200,420]
            }
          ]
        })
        window.addEventListener("resize", function() { //自动适应大小
        	myChart.resize();
        });
      }
    }
  }
</script>

<style>
</style>
